﻿package org.xhs.report.common.adv
{
    import baidu.ui.managers.*;
    import baidu.wenku.common.model.*;
    import flash.events.*;
    import flash.external.*;

    public class AdvFeModel extends EventDispatcher
    {
        private var _hasAdv:Boolean = false;
        private var _docTitle:String;
        private var _docId:String;
        private var _uid:String;
        private var _advUrl:String;
        private var storeModel:StoreModel;

        public function AdvFeModel(param1:IEventDispatcher = null)
        {
            super(param1);
            this.initModel();
            this.initThis();
            return;
        }// end function

        private function initModel() : void
        {
            this.storeModel = InstanceManager.createSingletonInstance(StoreModel);
            return;
        }// end function

        private function initThis() : void
        {
            var _loc_1:Object = null;
            if (ExternalInterface.available && this.storeModel.isStore)
            {
                _loc_1 = ExternalInterface.call("wenku.advertisement");
                if (_loc_1 && _loc_1.show)
                {
                    this._hasAdv = true;
                    this._docTitle = _loc_1.doc_title || "title";
                    this._docId = _loc_1.doc_id || "10000";
                    this._uid = _loc_1.uid || "uid";
                    this._advUrl = _loc_1.adv_url || "http://bb-testing-ecom221.vm.baidu.com:8080/ecom?di=565&tm=baiduASPT565S&word=xianhua&tn=";
                }
                else
                {
                    this._hasAdv = false;
                }
            }
            else
            {
                this._hasAdv = false;
            }
            return;
        }// end function

        public function get hasAdv() : Boolean
        {
            return this._hasAdv;
        }// end function

        public function get docTitle() : String
        {
            return this._docTitle;
        }// end function

        public function get docId() : String
        {
            return this._docId;
        }// end function

        public function get uid() : String
        {
            return this._uid;
        }// end function

        public function get advUrl() : String
        {
            return this._advUrl;
        }// end function

    }
}
